package com.eco.fanliapp.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.entity.AppGoods;
import com.eco.fanliapp.entity.GoodsFree;
import com.eco.fanliapp.vo.GoodsFreeInfo;
import com.github.pagehelper.PageInfo;

import java.util.HashMap;
import java.util.List;

public interface IGoodsFreeService extends IService<GoodsFree>
{

    /**
     * 增加置顶商品
     * @param goodsFreeInfo
     * @return
     */
   ServerResponse addGoodsFree(AppGoods goods, GoodsFreeInfo goodsFreeInfo);

   ServerResponse updateByGoodsFree(GoodsFree goodsFree);//修改免单信息

    /**
     * 根据商品id查询商品明细
     * @param goodsId
     * @return
     */
    GoodsFree selectByGoodsId(String goodsId);

    /**
     * 淘宝查询
     * @param goodsFreeInfo
     * @return
     */
    ServerResponse addGoodsFreeByTaoBao(GoodsFree goodsFreeInfo);

    /**
     * 查询所有置顶商品
     * @return
     */
    ServerResponse<PageInfo> findAll(Integer companyId, Integer currentPage, Integer pageSize);

    /**
     * 根据平台查询商品信息
     * @return
     */
    ServerResponse<List> selectByPlatform(Integer goodsPlatform);

    /**
     *  根据商品Id删除数据库的记录,goods_free
     *
     * @param goodsId
     */
    ServerResponse deleteByGoodsId(Integer goodsId);

    /**
     *  动态字段,根据商品Id来更新符合条件的数据库记录,goods_free
     *
     * @param record
     */
    ServerResponse updateByGoodsIdSelective(GoodsFree record);

    /**
     * 根据商品id或者商品名称模糊查询
     * @param goodsIdOrGoodsName
     * @return
     */
    ServerResponse<List> selectByGoodsIdOrGoodsName(String goodsIdOrGoodsName);

	 /**
	  * 根据平台或者关键字查询
	  * @param goodsPlatform
	  * @param keyWord
	  * @return
	  */
    ServerResponse<PageInfo> selectByKeyWord(Integer companyId, Integer goodsPlatform, String keyWord, Integer currentPage, Integer pageSize);

	 /**
	  *
	  * @param goodsId
	  * @param goodsFreeStage
	  * @return
	  */
    ServerResponse<PageInfo> updateGoodsFreeStageByGoodsId(String goodsId, Integer goodsFreeStage);

    /**
     *
     * @param numIid
     * @return
     */
	GoodsFree selectByGoodsId(Long numIid);

	/**
	 *
	 * @param numIid
	 * @return
	 */
	GoodsFree selectByGoodsIdAll(Long numIid);
	/**
	 *
	 * @param id
	 * @return
	 */
	int updateTotalOrdersByGoodsId(Integer id);

	/**
	 *
	 * @param id
	 * @return
	 */
	int updateInvalidOrdersByGoodsId(Integer id);

	/**
	 *
	 * @param id
	 * @return
	 */
	int updateTotalRetureAmountByGoodsId(Integer id);

	/**
	 *
	 * @param hashMap
	 * @return
	 */
    ServerResponse updateSerial(HashMap<String, Object> hashMap);

	/**
	 * 查询免单商品（商品未失效）
	 * @param currentPage
	 * @param pageSize
	 * @return
	 */
	ServerResponse<PageInfo> selectAllGoodsFree(Integer currentPage, Integer pageSize);

	int updateGoodsStausByGoodsFree(GoodsFree goodsFree1);

	ServerResponse<String> checkHaveBuy(Long userId, Integer isTaskUse);

    ServerResponse<String> backRemind(Long userId);
}
